package com.wecan.base.utils;

/**
 * @Author liuzhihao
 * @Date 2022.01.15
 * @Version 1.0.0
 * @Description 文件工具类
 */
public class FileUtils {

    /**
     * 获取文件类型
     * @param fileType
     * @return
     */
    public static String getContentType(String fileType) {
        if (".bmp".equalsIgnoreCase(fileType)) {
            return "image/bmp";
        }
        if (".gif".equalsIgnoreCase(fileType)) {
            return "image/gif";
        }
        if (".jpeg".equalsIgnoreCase(fileType)) {
            return "image/jpeg";
        }
        if (".jpg".equalsIgnoreCase(fileType)) {
            return "image/jpg";
        }
        if (".png".equalsIgnoreCase(fileType)) {
            return "image/png";
        }
        if (".html".equalsIgnoreCase(fileType)) {
            return "text/html";
        }
        if (".txt".equalsIgnoreCase(fileType)) {
            return "text/plain";
        }
        if (".vsd".equalsIgnoreCase(fileType)) {
            return "application/vnd.visio";
        }
        if (".ppt".equalsIgnoreCase(fileType) || "pptx".equalsIgnoreCase(fileType)) {
            return "application/vnd.ms-powerpoint";
        }
        if (".doc".equalsIgnoreCase(fileType) || "docx".equalsIgnoreCase(fileType)) {
            return "application/msword";
        }
        if (".xml".equalsIgnoreCase(fileType)) {
            return "text/xml";
        }
        if (".mp4".equalsIgnoreCase(fileType)) {
            return "video/mp4";
        }
        if (".mp3".equalsIgnoreCase(fileType)) {
            return "audio/mp3";
        }
        return "text/html";
    }
}
